package com.changil.nowonchangil.controller;

import java.util.ArrayList;

import com.changil.nowonchangil.db.ArticleManager;
import com.changil.nowonchangil.db.UserManager;
import com.changil.nowonchangil.dto.Article;
import com.changil.nowonchangil.dto.User;

public class ServiceController {

	//게시글 관련
	public ArrayList<Article> getArticles(int boardId, int fromId, int count, boolean isDownSide) {
		return ArticleManager.getsInstance().select(boardId, fromId, count, isDownSide);
	}
	
	public int addArticle(int boardId, String title, String content) {
		return ArticleManager.getsInstance().insert(boardId, title, content);
	}
	
	public int updateArticle(int targetId,String newTitle,String newContent) {
		return ArticleManager.getsInstance().update(targetId,newTitle,newContent);
	}
	
	public int deleteArticle(int targetId) {
		return ArticleManager.getsInstance().delete(targetId);
	}
	
	
	//User 관련
	public User login(String id, String password) {
		return UserManager.getsInstance().select(id, password);
	}
}
